package cn.java.threadmodel.pipeline;

/**
 * @author 小石潭记
 * @date 2021/12/18 19:18
 * @Description: ${todo}
 */
public class TestHandler1 implements Handler {
    @Override
    public void channelRead(HandlerContext ctx, Object msg) {
        try {
            Thread.sleep(1000);//模拟阻塞
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //在字符串后面加特定字符串
        String result = msg + "-handler1";
        System.out.println(result);
        //写入操作，这个操作是必须的，相当于将结果传递给下一个handler
        ctx.write(result);
    }
}
